package VO;

import java.util.ArrayList;
import User.*;
import User.SaleManager;

public class SaleManagerListVO extends UserListVO{
	ArrayList<SaleManagerVO> SaleManagerlist = new ArrayList<SaleManagerVO>();
	String SaleManagerID="";
	
	public SaleManagerListVO(){}
	
	public SaleManagerListVO(ArrayList<SaleManagerVO>  slist){
		SaleManagerlist=slist;
		init();
	}
	public SaleManagerListVO(SaleManagerList  samlist){
		for(SaleManager s: samlist.getSaleManagerlist()){
			SaleManagerVO samvo=new SaleManagerVO(s);
			SaleManagerlist.add(samvo);
		}
		SaleManagerID=samlist.getUserID();
	}
	public SaleManagerListVO(String samlistinfo[][]){
		for(String saminfo[]:samlistinfo){
			SaleManagerVO sam=new SaleManagerVO(saminfo);
			SaleManagerlist.add(sam);
		}
	}
	
	public SaleManagerListVO(SaleManagerListVO samuserlOfAll,String samidList){
		String[] gidlist=samidList.split("/");
		if(samidList.equals("")){
			for(String id:gidlist){
				SaleManagerVO samvo=samuserlOfAll.find(Long.parseLong(id));
				SaleManagerlist.add(samvo);
			}
			init();
		}
		
	}
	public void init(){
		for(SaleManagerVO sam:SaleManagerlist){
			SaleManagerID=SaleManagerID+"/"+sam.getId();
		}
	}
	public SaleManagerVO find(long id){
		SaleManagerVO sam=null;
		for(SaleManagerVO sv:SaleManagerlist){
			if(sv.getId()==id){
				sam=sv;
				break;
			}
		}
		return sam;
	}
	public ArrayList<SaleManagerVO> getSaleManagerlist(){
		return SaleManagerlist;
	}
	public String getSaleManagerlid(){
		return SaleManagerID;
	}

}

